package net.cyndeline.scalarlib.rldungeon.dgs

import scalax.collection.immutable.Graph
import net.cyndeline.scalarlib.rldungeon.dgs.graph.{DGSFunctionality, Room}
import scalax.collection.GraphEdge.UnDiEdge

/**
 * Computes the maximum amount of responders (and their respective activators) that should be placed on a map,
 * based on the topology of the map itself.
 *
 * Note that the implementation of this trait is not responsible for making sure that the map can be completed
 * after all responders have been placed, or that there's enough space to place the specified amount. The algorithm
 * will stop when all pointless areas have been dealt with, the only purpose of this class is to let the user
 * put an upper bound on the number of responders being placed.
 *
 * @tparam VType Type of room vertex used in the graph.
 * @tparam EType Type of corridor edge used in the graph.
 */
trait ActivatorResponderAmountEstimator[VType <: Room[VType], EType[X] <: UnDiEdge[X] with DGSFunctionality[X, EType]] {

  /**
   * Computes the amount of responder/activator pairs that should be placed on a map. When the amount is
   * reached, the remaining areas are made meaningful using rewards only.
   * @param graph Graph to compute responder amount for. The graph will have its topology computed and pointless
   *              vertices marked as such, but no object-populating productions will have been applied.
   * @return Upper an lower integer bounds to use when randomly selecting the maximum amount of responders to place
   *         on the map.
   */
  def computeResponderAmount(graph: Graph[VType, EType]): ActivatorResponderAmountResult

}
